<template>
	<view class="page flex-col">
		<cu-custom bgColor="bg-gradual-red" :isBack="true">
			<block slot="content">我的保证金</block>
		</cu-custom>
		<empty v-if="auctionbiddinglistData.length == 0"></empty>
		<view class="section1 flex-col" v-else>
			<view class="Body flex-col">
				<view class="bd2 flex-col justify-between">
					<view class="box3 flex-col">
						<view class="group1 flex-col" v-for="(item, index1) in auctionbiddinglistData" :key="index1" @click="godetail(item)">
							<view class="outer1 flex-row justify-between">
								<view class="box4 flex-col">
									<image class="box5" :src="$getFileAccessHttpUrl(item.icon)" mode="aspectFill"></image>
								</view>
								<view class="box6 flex-col  justify-between">
									<view class="TextGroup1 flex-col">
										<view class="txt2">{{item.auctionName}}</view>
										<view class="wordbox">
											<view class="word3">标的物：{{item.auctionItemName}}</view>
										</view>
										<view class="wordbox">
											<view class="word3">状态：</view>
											<view class="word3 labelorgan" v-if="item.status == 0">
												待审核
											</view>
											<view class="word3 labelgereen" v-if="item.status == 1">
												审核通过
											</view>
											<view class="word3 labelred" v-if="item.status == 2">
												审核不通过
											</view>
										</view>

									</view>
								</view>
							</view>

						</view>
					</view>
				</view>
				<view class="loadingType">{{loadingType ?'没有更多数据了!' : '上拉显示更多'}}</view>
			</view>

		</view>
	</view>

</template>

<script>
	import server from '@/api/server.js'
	export default {
		props: {},
		data() {
			return {
				hr: 0,
				min: 0,
				sec: 0,
				timeend: '',
				tabIndex: 0, // 选中的
				auctionbiddinglistData: [],
				loadingType: false,
				params: {
					pageNo: 1,
					pageSize: 10,
				},
			};
		},
		onLoad: function() {

		},
		mounted() {
			this.datetime('00:03:01')
			this.apiwarrantylist()
		},
		computed: {

		},
		//在.js文件中监听下拉触底
		onReachBottom: function() {
			console.log('1324543456')
			if (!this.loadingType) {
				this.apiwarrantylist()
			}
		},
		methods: {
			godetail(data){
				uni.navigateTo({
					url: '/page_myauction/mydeposit/mydepositDetail?warrantyId=' + data.warrantyId
				})
			},
			apiwarrantylist() {
				server.warrantylist(this.params).then(res => {
					console.log(res)
					if (res.data.success) {
						if (res.data.result.records.length != 10) { //没有数据
							this.loadingType = true;
						}
						this.params.pageNo++; //每触底一次 page +1
						this.auctionbiddinglistData = this.auctionbiddinglistData.concat(res.data.result
						.records); //将数据拼接在一起
					}
				})
			},
			//
			datetime: function(time) {
				//传过来的时间time可以是分钟数，也可以是时间戳
				//获取当前时间
				let newdate = new Date();
				//当前时间从1970.1.1到现在的毫秒数
				this.timenow = newdate.getTime();
				//判断时间类型给结束时间赋值
				if (typeof time == "number") {
					this.timeend = this.timenow + time * 60 * 1000;
					console.log(this.timeend)
				} else if (typeof time == "string") {
					this.timeend = new Date(time).getTime();
					console.log(this.timeend)
				} else {
					alert("请输入正确时间");
				}
				console.log(this.timeend)
			}
		},

		beforeDestroy() {

		},
	}
</script>

<style scoped lang="scss">

</style>
